Update dependency seaborn to ~0.13.0 #668
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
~0.11
->~0.13.0
Release Notes
mwaskom/seaborn (seaborn)
v0.13.0
: v0.13.0 (September 2023)Compare Source
See the online docs for an annotated version of these notes with working links.
This is a major release with a number of important new features and changes. The highlight is a major overhaul to seaborn's categorical plotting functions, providing them with many new capabilities and better aligning their API with the rest of the library. There is also provisional support for alternate dataframe libraries like polars, a new theme and display configuration system for
objects.Plot
, and many smaller bugfixes and enhancements.Updating is recommended, but users are encouraged to carefully check the outputs of existing code that uses the categorical functions, and they should be aware of some deprecations and intentional changes to the default appearance of the resulting plots (see notes below with and tags).
Major enhancements to categorical plots
Seaborn's
categorical functions <categorical_api>
have been completely rewritten for this release. This provided the opportunity to address some longstanding quirks as well as to add a number of smaller but much-desired features and enhancements.Support for numeric and datetime data
The categorical functions have historically treated all data as categorical, even when it has a numeric or datetime type. This can now be controlled with the new native_scale parameter. The default remains False to preserve existing behavior. But with native_scale=True, values will be treated as they would by other seaborn or matplotlib functions. Element widths will be derived from the minimum distance between two unique values on the categorical axis.
Additionally, while seaborn previously determined the mapping from categorical values to ordinal positions internally, this is now delegated to matplotlib. The change should mostly be transparent to the user, but categorical plots (even with native_scale=False) will better align with artists added by other seaborn or matplotlib functions in most cases, and matplotlib's interactive machinery will work better.
Changes to color defaults and specification
The categorical functions now act more like the rest of seaborn in that they will produce a plot with a single main color unless the hue variable is assigned. Previously, there would be an implicit redundant color mapping (e.g., each box in a boxplot would get a separate color from the default palette). To retain the previous behavior, explicitly assign a redundant hue variable (e.g., boxplot(data, x="x", y="y", hue="x")).
Two related idiosyncratic color specifications are deprecated, but they will continue to work (with a warning) for one release cycle:
Finally, like other seaborn functions, the default palette now depends on the variable type, and a sequential palette will be used with numeric data. To retain the previous behavior, pass the name of a qualitative palette (e.g., palette="deep" for seaborn's default). Accordingly, the functions have gained a parameter to control numeric color mappings (hue_norm).
Other features, enhancements, and changes
The following updates apply to multiple categorical functions.
boxplot
,boxenplot
, andviolinplot
functions now support a single linecolor parameter.pointplot
or the kernel density fit inviolinplot
) are now applied in that scale space.The following updates are function-specific.
pointplot
, a singlematplotlib.lines.Line2D
artist is now used rather than adding separatematplotlib.collections.PathCollection
artist for the points. As a result, it is now possible to pass additional keyword arguments for complete customization the appearance of both the lines and markers; additionally, the legend representation is improved. Accordingly, parameters that previously allowed only partial customization (scale, join, and errwidth) are now deprecated. The old parameters will now trigger detailed warning messages with instructions for adapting existing code.violinplot
better aligns withkdeplot
, as the bw parameter is now deprecated in favor of bw_method and bw_adjust.boxenplot
, the boxen are now drawn with separate patch artists in each tail. This may have consequences for code that works with the underlying artists, but it produces a better result for low-alpha / unfilled plots and enables proper area/density scaling.barplot
, the errcolor and errwidth parameters are now deprecated in favor of a more general err_kws` dictionary. The existing parameters will continue to work for two releases.violinplot
, the scale and scale_hue parameters have been renamed to density_norm and common_norm for clarity and to reflect the fact that common normalization is now applied over both hue and faceting variables incatplot
.boxenplot
, the scale parameter has been renamed to width_method as part of a broader effort to de-confound the meaning of "scale" in seaborn parameters.barplot
orpointplot
, a bar or point will be drawn for each entry in the vector rather than plotting a single aggregated value. To retain the previous behavior, assign the vector to the y variable.boxplot
, the default flier marker now follows the matplotlib rcparams so that it can be globally customized.violinplot
, a separate mini-box is now drawn for each split violin.boxenplot
, all plots now use a consistent luminance ramp for the different box levels. This leads to a change in the appearance of existing plots, but reduces the chances of a misleading result.boxenplot
now approximates the density of the underlying observations, including for asymmetric distributions. This produces a substantial change in the appearance of plots with width_method="area", although the existing behavior was poorly defined.countplot
, the new stat parameter can be used to apply a normalization (e.g to show a "percent" or "proportion").violinplot
is now more general and can be set to True regardless of the number of hue variable levels (or even without hue). This is probably most useful for showing half violins.violinplot
, the new inner_kws parameter allows additional control over the interior artists.catplot
, as data vectors can now be passed directly.boxplot
, the artists that comprise each box plot are now packaged in a BoxPlotContainer for easier post-plotting access.Support for alternate dataframe libraries
3369
).Improved configuration for the objects interface
objects.Plot
(3223
)objects.Plot
(3225
).objects.Plot
via the new label parameter inobjects.Plot.add
(3456
).objects.Plot.scale
,objects.Plot.limit
, andobjects.Plot.label
the x / y parameters can be used to set a common scale / limit / label for paired subplots (3458
).Other updates
3467
).ecdfplot
, stat="percent" is now a valid option (3336
).3488
).histplot
, infinite values are now ignored when choosing the default bin range (3488
).3440
).load_dataset
to use an approach more compatible with pyiodide (3234
).3452
).histplot
, treatment of the binwidth parameter has changed such that the actual bin width will be only approximately equal to the requested width when that value does not evenly divide the bin range. This fixes an issue where the largest data value was sometimes dropped due to floating point error (3489
).objects.Bar
andobjects.Bars
widths when using a nonlinear scale (3217
).move_legend
when labels were provided (3454
).histplot
added a stray empty BarContainer (3246
).objects.Plot.on
would override a figure's layout engine (3216
).lineplot
with a list of tuples for the keyword argument dashes caused a TypeError (3316
).PairGrid
that caused an exception when the input dataframe had a column multiindex (3407
).3394
).v0.12.2
: (December 2022)Compare Source
v0.12.2 (December 2022)
This is an incremental release that is a recommended upgrade for all users. It is very likely the final release of the 0.12 series and the last version to support Python 3.7.
|Feature| Added the
objects.KDE
stat (#3111).|Feature| Added the
objects.Boolean
scale (#3205).|Enhancement| Improved user feedback for failures during plot compilation by catching exceptions and re-raising with a
PlotSpecError
that provides additional context. (#3203).|Fix| Improved calculation of automatic mark widths with unshared facet axes (#3119).
|Fix| Improved robustness to empty data in several components of the objects interface (#3202).
|Fix| Fixed a bug where legends for numeric variables with large values would be incorrectly shown (i.e. with a missing offset or exponent; #3187).
|Fix| Fixed a regression in v0.12.0 where manually-added labels could have duplicate legend entries (#3116).
|Fix| Fixed a bug in
histplot
withkde=True
andlog_scale=True
where the curve was not scaled properly (#3173).|Fix| Fixed a bug in
relplot
where inner axis labels would be shown when axis sharing was disabled (#3180).|Fix| Fixed a bug in
objects.Continuous
to avoid an exception with boolean data (#3190).v0.12.1
Compare Source
This is an incremental release that is a recommended upgrade for all
users. It addresses a handful of bugs / regressions in v0.12.0 and adds
several features and enhancements to the new objects interface.
objects.Text
mark (#3051).objects.Dash
mark (#3074).objects.Perc
stat (#3063).objects.Count
stat (#3086).objects.Band
andobjects.Range
marks will now cover the fullextent of the data if
min
/max
variables are not explicitly assigned oradded in a transform (#3056).
objects.Jitter
move now applies a small amount of jitter bydefault (#3066).
objects.Nominal
scale now appear like categorical axesin classic seaborn, with fixed margins, no grid, and an inverted y
axis (#3069).
objects.Continuous.label
method now acceptsbase=None
to override the default formatterwith a log transform (#3087).
objects.Line
) now use astable algorithm (#3064).
label
parameter topointplot
,which addresses a regression in 0.12.0 when
pointplot
is passed toFacetGrid
(#3016).the same mappings were added to
objects.Plot
(#3055).objects.PolyFit
robust to missing data (#3010).objects.Plot
that occurred when data assigned to theorient coordinate had zero variance (#3084).
kdeplot
where passingcmap
for an unfilled bivariate plot wouldraise an exception (#3065).
lineplot
with a large numberof unique x values (#3081).
testing infrastructure (#3034).
v0.12.0
Compare Source
Introduction of the objects interface
This release debuts the seaborn.objects interface, an entirely new approach to making plots with seaborn. It is the product of several years of design and 16 months of implementation work. The interface aims to provide a more declarative, composable, and extensible API for making statistical graphics. It is inspired by Wilkinson's grammar of graphics, offering a Pythonic API that is informed by the design of libraries such as ggplot2 and vega-lite along with lessons from the past 10 years of seaborn's development.
For more information and numerous examples, see the tutorial chapter and API reference.
This initial release should be considered "experimental". While it is stable enough for serious use, there are definitely some rough edges, and some key features remain to be implemented. It is possible that breaking changes may occur over the next few minor releases. Please be patient with any limitations that you encounter and help the development by reporting issues when you find behavior surprising.
Keyword-only arguments
Seaborn's plotting functions now require explicit keywords for most arguments, following the deprecation of positional arguments in v0.11.0. With this enforcement, most functions have also had their parameter lists rearranged so that data is the first and only positional argument. This adds consistency across the various functions in the library. It also means that calling func(data) will do something for nearly all functions (those that support wide-form data) and that
pandas.DataFrame
can be piped directly into a plot. It is possible that the signatures will be loosened a bit in future releases so that x and y can be positional, but minimal support for positional arguments after this change will reduce the chance of inadvertent mis-specification (2804
).Modernization of categorical scatterplots
This release begins the process of modernizing the categorical plots, beginning with
stripplot
andswarmplot
. These functions are sporting some enhancements that alleviate a few long-running frustrations (2413
,2447
):native_scale
parameter allows numeric or datetime categories to be plotted with their original scale rather than converted to strings and plotted at fixed intervals.formatter
parameter allows more control over the string representation of values on the categorical axis. There should also be improved defaults for some types, such as dates.hue
when using only one coordinate variable (i.e. onlyx
ory
).The updates also harmonize behavior with functions that have been more recently introduced. This should be relatively non-disruptive, although a few defaults will change:
scatterplot
. Pass palette="deep" to reproduce previous defaults.Similar enhancements / updates should be expected to roll out to other categorical plotting functions in future releases. There are also several function-specific enhancements:
stripplot
, a "strip" with a single observation will be plotted without jitter (2413
)swarmplot
, the points are now swarmed at draw time, meaning that the plot will adapt to further changes in axis scaling or tweaks to the plot layout (2443
).swarmplot
, the proportion of points that must overlap before issuing a warning can now be controlled with the warn_thresh parameter (2447
).swarmplot
, the order of the points in each swarm now matches the order in the original dataset; previously they were sorted. This affects only the underlying data stored in the matplotlib artist, not the visual representation (2443
).More flexible errorbars
Increased the flexibility of what can be shown by the internally-calculated errorbars for
lineplot
,barplot
, andpointplot
.With the new errorbar parameter, it is now possible to select bootstrap confidence intervals, percentile / predictive intervals, or intervals formed by scaled standard deviations or standard errors. The parameter also accepts an arbitrary function that maps from a vector to an interval. There is a new user guide chapter demonstrating these options and explaining when you might want to use each one.
As a consequence of this change, the ci parameter has been deprecated. Note that
regplot
retains the previous API, but it will likely be updated in a future release (2407
,2866
).Other updates
lineplot
along the y axis using orient="y" (2854
).FacetGrid
/PairGrid
/JointGrid
with a fluent (method-chained) style by adding apply/ pipe methods. Additionally, fixed the tight_layout and refline methods so that they return self (2926
).FacetGrid.tick_params
andPairGrid.tick_params
to customize the appearance of the ticks, tick labels, and gridlines of all subplots at once (2944
).barplot
(2860
).barplot
andpointplot
, in addition to a callable (2866
).regplot
now inherit the alpha value of the points they correspond to (2540
).pairplot
with corner=True and diag_kind=None, the top left y axis label is no longer hidden (2850
).histplot
as a step function or polygon (2859
).boxenplot
with box_kws/line_kws/flier_kws (2909
).2449
).2776
).histplot
andkdeplot
where weights were not factored into the normalization (2812
).histplot
when only binwidth was provided (2813
).violinplot
where inner boxes/points could be missing with unpaired split violins (2814
).PairGrid
where an error would be raised when defining hue only in the mapping methods (2847
).scatterplot
where an error would be raised when hue_order was a subset of the hue levels (2848
).histplot
where dodged bars would have different widths on a log scale (2849
).lineplot
, allowed the dashes keyword to set the style of a line without mapping a style variable (2449
).relplot
for "wide" data and for faceting variables passed as non-pandas objects (2846
).FacetGrid.map
orFacetGrid.map_dataframe
(2705
).2925
).kdeplot
(2862
).rugplot
was ignoring expand_margins=False (2953
).set_palette
(orset_theme
). This should have no general effect, because the matplotlib default is now "C0" (2906
).2398
).2773
).2833
).pointplot
.Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Never, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.